package com.ruoyi.system.service;

import com.ruoyi.system.domain.PoPublicOpinion;
import com.ruoyi.system.domain.PublicOpinionEvents;
import com.ruoyi.system.domain.PublicOpinionTopic;
import com.ruoyi.system.domain.WarningRule;
import org.elasticsearch.index.query.BoolQueryBuilder;

import java.util.Date;
import java.util.List;

public interface ElasticsearchQueryBuilderService {

    /**
     * 构建查询语句
     * @param searchArea
     * @param relatedWords
     * @param opinionWords
     * @param exclusionWords
     * @return
     */
    BoolQueryBuilder  boolQueryBuilder(BoolQueryBuilder matchQueryBuilder,String searchArea,String relatedWords,String opinionWords,String exclusionWords);

    /**
     * 构建查询语句（包含开始结束时间）
     * @param matchQueryBuilder
     * @param searchArea
     * @param relatedWords
     * @param opinionWords
     * @param exclusionWords
     * @param startTime
     * @param endTime
     * @return
     */
    BoolQueryBuilder  boolQueryBuilder(BoolQueryBuilder matchQueryBuilder, String searchArea, String relatedWords, String opinionWords, String exclusionWords, Date startTime, Date endTime);

    /**
     * 主题查询语句
     * @param topic
     * @return
     */
    BoolQueryBuilder  boolQueryBuilder(PublicOpinionTopic topic);


    /**
     *  构建舆情检索的开始时间
     * @param startTime
     * @return
     */
    BoolQueryBuilder  boolQueryBuilderStartTime(BoolQueryBuilder matchQueryBuilder,Date startTime);

    /**
     *  构建舆情检索的结束时间
     * @param endTime
     * @return
     */
    BoolQueryBuilder  boolQueryBuilderEndTime(BoolQueryBuilder matchQueryBuilder,Date endTime);

    /**
     *  构建舆情检索的开始结束时间
     * @param startTime
     * @param endTime
     * @return
     */
    BoolQueryBuilder  boolQueryBuilder(BoolQueryBuilder matchQueryBuilder,Date startTime,Date endTime);

    /**
     * 事件查询语句
     * @param event
     * @return
     */
    BoolQueryBuilder  boolQueryBuilder(PublicOpinionEvents event);


    /**
     * 主题查询语句
     * @param topics
     * @return
     */
    BoolQueryBuilder  boolQueryBuilder(List<PublicOpinionTopic> topics);

    /**
     * 事件查询语句
     * @param events
     * @return
     */
    BoolQueryBuilder  boolQueryBuilderOfEvent(List<PublicOpinionEvents> events);


    /**
     * 事件及主题查询语句
     * @param events
     *      * @param topics
     * @return
     */
    BoolQueryBuilder  boolQueryBuilder(List<PublicOpinionEvents> events,List<PublicOpinionTopic> topics);


    /**
     * 根据预警规则构建查询语句
     * @param rule
     * @return
     */
    BoolQueryBuilder  boolQueryBuilder(WarningRule rule);

}
